package ecom.entity;

import javax.persistence.*;

import java.io.Serializable;
import java.util.*;

@Entity
public class AnnonceEntity implements Serializable {

  private static final long serialVersionUID = 2827287986889306938L;

  
	private long annonceid;
	private Date date = new Date();
	private String titre;
	private String texte;
	private boolean active = true;
	private int departement;
	private String ville;
	private String photo;
  
	private List<OptionAchetee> options;
  

	public AnnonceEntity(){
	}
	
	public AnnonceEntity(String titre, String texte, int departement, String ville, String photo){
	    this.setTitre(titre);
	    this.setTexte(texte);
	    this.setDepartement(departement);
	    this.setVille(ville);
	    this.setPhoto(photo);
	}
	  
	public void setTitre(String titre){
	    this.titre = titre;
	}
	
	public String getTitre(){
	    return titre;
	}
	
	public void setTexte(String texte){
	    this.texte = texte;
	}
	
	public String getTexte(){
	    return texte;
	}
	
	public void setActive(boolean active){
	    this.active = active;
	}
	
	public boolean getActive(){
	    return active;
	}
	
	public void setVille(String ville){
		    this.ville = ville;
	}
	
	public String getVille(){
		    return ville;
	}
	
	public void setAnnonceid(long id){
		this.annonceid = id;
	}
	  
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)	  
	public Long getAnnonceid(){
		return annonceid;
	}
		  
	public void setOptions(List<OptionAchetee> newopt){
		this.options = newopt;
	}
	  
	@OneToMany(mappedBy = "anonce")
	public List<OptionAchetee> getOptions(){
		return this.options;
	}

	public Date getDate() {
		return date;
	}
	
	public void setDate(Date date) {
		this.date = date;
	}

	public String getPhoto() {
		return photo;
	}

	public void setPhoto(String photo) {
		this.photo = photo;
	}

	public int getDepartement() {
		return departement;
	}

	public void setDepartement(int departement) {
		this.departement = departement;
	}

}